package com.pesilo.module.navigate.mvc.model
{
	import flash.net.SharedObject;
	
	import org.puremvc.as3.multicore.interfaces.IProxy;
	import org.puremvc.as3.multicore.patterns.proxy.Proxy;

	public class CookiesProxy extends Proxy implements IProxy
	{
		public static const NAME:String="CookiesProxy";
		public var shared:SharedObject;
		
		public function CookiesProxy()
		{
			super(NAME);
		}
		
		/**
		 * 设置被赞
		 */
		public function praised():void{
			shared=SharedObject.getLocal("pesilo");
			shared.data.praised=true;
			shared.data.month=new Date().month;
			shared.data.date=new Date().date;
			
			shared.flush();
			
			
		}
		
		/**
		 * 检查今天有没有被赞过
		 */
		public function checkPraise():Boolean{
			shared=SharedObject.getLocal("pesilo");
			if(shared.data.date!=new Date().date||shared.data.month!=new Date().month){
				shared.data.month=new Date().month;
				shared.data.date=new Date().date;
				shared.data.praised=false;
				shared.flush();
			}
			return shared.data.praised;
		}
	}
}